﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Cosmetic.Logic;

public partial class Controls_ProductByBrandOrderComments : System.Web.UI.UserControl
{
	private ProductManager	m_ProductManager	= new ProductManager();

	private int m_ShowCount		= 10;
	public int ShowCount
	{
		get { return m_ShowCount; }
		set { m_ShowCount = value; }
	}

	private Guid m_BrandId;

	public Guid BrandId
	{
		get 
		{
			return m_BrandId; 
		}
		set 
		{
			m_BrandId = value;
			this.BindProduct();
		}
	}

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
		{
			this.BindProduct();
		}
	}

	private void BindProduct()
	{
		this.lvProductWeek.DataSource	= this.m_ProductManager.GetProductByBrandOrderComments(BrandId, DateTime.Today.AddDays(-7), DateTime.Today, this.ShowCount);
		this.lvProductWeek.DataBind();

		this.lvProductMonth.DataSource	= this.m_ProductManager.GetProductByBrandOrderComments(BrandId, DateTime.Today.AddDays(-30), DateTime.Today, this.ShowCount);
		this.lvProductMonth.DataBind();
	}
}
